<template>
<view class="footer">
	<view class="fix-wrap nav">
		<navigator url="/pages/index/index" open-type="reLaunch" hover-class="none" :class="['item flex-grow-1',{'active':switchTab==1}]">
			<view class="icon">
				<view class="iconfont f-s40">&#xe600;</view>
			</view>				
			<view class="name">首页</view>
		</navigator>
		<navigator url="/package_project/index/index" open-type="reLaunch" hover-class="none" :class="['item flex-grow-1',{'active':switchTab==4}]">
			<view class="icon">
				<view class="iconfont f-s36">&#xe7de;</view>
			</view>
			<view class="name">主界面</view>
		</navigator>
		<navigator url="/package_customer/customer-list/customer-list" open-type="reLaunch" hover-class="none" :class="['item flex-grow-1',{'active':switchTab==2}]">
			<view class="icon">
				<view class="iconfont f-s40">&#xe67c;</view> 
				<!-- <view v-if="msg_number>0" class="num">{{msg_number>99?'99+':msg_number}}</view> -->
			</view>
			<view class="name">聊天室</view>
		</navigator>
		<!-- <navigator url="/pages/msg/msg" open-type="reLaunch" hover-class="none" :class="['item flex-grow-1',{'active':switchTab==2}]">
			<view class="icon">
				<view class="iconfont f-s40">&#xe67c;</view> 
				<view v-if="msg_number>0" class="num">{{msg_number>99?'99+':msg_number}}</view>
			</view>
			<view class="name">消息</view>
		</navigator> -->
		<navigator url="/pages/project/project" open-type="reLaunch" hover-class="none" :class="['item flex-grow-1',{'active':switchTab==3}]">
			<view class="icon">
				<view class="iconfont f-s36">&#xe651;</view> 
			</view>
			<view class="name">项目</view>
		</navigator> 
		
	</view>
</view>
</template>

<script> 
export default{
	name:'demo',
	data(){
		return{
			// isLogin:false,
			isIphoneX:getApp().globalData.isIphoneX, 
			msg_number:0,  
		}
	},
	props:{
		switchTab:{
			type:Number
		} 
	},
	async onReady() {  
		 
	}, 
	async mounted() { 
		this.getMessageList(); 
	},
	methods:{ 
		// 获取消息
		async getMessageList(){ 
			let res=await this.$api.user_api.addMsgTypeList();  
			if(res.data.code==200){   
				res.data.data.forEach(item=>{
					this.msg_number+=Number(item.count)
				}) 
			}
		}, 
		
	},
	computed:{
		list_update(){
			return this.$store.state.msg_state;
		}
	},
	watch:{
		list_update(newer,older){  
			if(newer!=older){
				this.msg_number=0; 
				this.getMessageList(); 
			}
		} 
	}
}
</script>

<style lang="less">
 
</style>
